Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a ipfs repo ls-roots command #2447

Closed
wants to merge 5 commits into from
Closed

Conversation

MichaelMure
Copy link
Contributor

This PR follow #1736 that can't be reopened.

Here is how it looks like now:

$ ipfs repo ls-root
QmRjdPNn6FVWV7szxCCuaCaBwvLuxLBEreeEiNuARyk4yS  46KB    Directory       recursive
QmRyWyKWmphamkMRnJVjUTzSFSAAZowYP4rnbgnfMXC9Mr  4.9MB   Directory       
QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn  4B      Directory       
QmVaL8gzpDomkn3Zipjo319SSWZpNM2gpNXWSFNFnSmwit  4.1KB   File            recursive

A couple of notes:

  • Instead of just looking for pinned object, this command now find the roots of the DAG so also display "free-floating" objects in the repo
  • This PR also make the pinner clean its old root node after each flush to avoid having them laying around until the next repo garbage collect. This is necessary as this command find the roots of the DAG
  • As Blockstore.AllKeysChan() is not deterministic, the order of the result is not deterministic either. Is this a problem ?

I also got hit by #1554. Some keys are not retrieved by Blockstore.AllKeysChan() so it break the root finding algorithm and some extra objects are displayed.

…e locally

Currently use the recursive pin to find the top hash, so it doesn't list everything.

License: MIT
Signed-off-by: Michael Muré <batolettre@gmail.com>
License: MIT
Signed-off-by: Michael Muré <batolettre@gmail.com>
License: MIT
Signed-off-by: Michael Muré <batolettre@gmail.com>
License: MIT
Signed-off-by: Michael Muré <batolettre@gmail.com>
Tagline: "Display the top nodes stored locally",
ShortDescription: `
'ipfs repo ls-roots' will display the top-level files or directory
that are stored locally as well a some of their properties.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as well as some

License: MIT
Signed-off-by: Michael Muré <batolettre@gmail.com>

unixFSNode, err := unixfs.FromBytes(node.Data)
if err != nil {
// ignore nodes that are not unixFs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of ignoring them, maybe we could just put their type as 'Unknown' or something?

@whyrusleeping whyrusleeping added the need/author-input Needs input from the original author label May 14, 2016
@whyrusleeping
Copy link
Member

Has been marked 'waiting on author' for about a year. Closing for now. Please do feel free to reopen this as necessary. Closing old PRs just helps us more easily see what needs immediate attention

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/author-input Needs input from the original author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants